<template>
	<view class="tai-lock" :class="{'isloading': loading}" :style="{width: size, height: size}" @click="onClick">
		<view class="tai-lock__wrap">
			<!-- <uni-icons type="locked" size="48"></uni-icons> -->
			<slot></slot>
		</view>
		<view class="tai-lock__after"></view>
	</view>
</template>

<script>
	export default {
		emit: ["click"],
		props: {
			size: {
				type: String,
				default: '360rpx'
			}
		},
		data() {
			return {
				loading: false
			}
		},
		methods: {
			onClick() {
				this.$emit("click")
			}
		}
	}
</script>

<style lang="scss" scoped>
	.tai-lock {
		width: 360rpx;
		height: 360rpx;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		box-shadow: 0 1px 2px 2px #eee;
		z-index: 9;

		.tai-lock__wrap {
			width: 95%;
			height: 95%;
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: column;
			border-radius: 50%;
			box-shadow: 0 0 5px 5px #fff inset;
			background: linear-gradient(to bottom, #ddd, #eee, #efefef, #fff);
		}
	}

	.isloading {
		position: relative;
		z-index: 9;
		.tai-lock__after {
			position: absolute;
			width: 98%;
			height: 95%;
			// background: linear-gradient(to right, #8EC5FC, #E0C3FC);
			// box-shadow: 0 0 0 5px #ccc;
			border-radius: 50%;
			z-index: -2;
			animation: spread 2s ease-in infinite;
			filter: blur(5px);
		}
	}

	@keyframes rotate {
		from {
			transform: rotate(0deg);
		}

		to {
			transform: rotate(360deg);
		}
	}
	@keyframes spread {
		from {
			transform: rotate(0deg);
			box-shadow: 0 0 5px 0 #aaa;
		}
		
		50% {
			transform: rotate(180deg);
			box-shadow: 0 0 15px 1px #aaa;
		}
	
		to {
			transform: rotate(360deg);
			box-shadow: 0 0 5px 0 #aaa;
		}
	}
</style>
